<?php include 'function.php'; ?>
<meta charset='utf8'>
<form action="config.php" method="get">
	 <p>开始号码:<input type='text' name='s'></p>
	 <p>结束号码:<input type='text' name='e'></p>
	 <input type="submit">
</form>
<?php

		$file_name = "获奖名单.txt";
		$file_name=iconv("utf-8","gb2312",$file_name);
		$f = fopen($file_name, "w") or die("Unable to open file!");
		fclose($f);

		$myfile = fopen("YiChou.txt", "w") or die("Unable to open file!");
		fclose($myfile);

		if (isset($_GET['s'])&&isset($_GET['e'])) {
			echo '<p><a href="layout.html">进入抽奖</a></p>';
			echo "<p>参与者</p>";
			echo "<p>从".$_GET['s'].'到'.$_GET['e']."</p>";
			$nums=mk_num($_GET['s'],$_GET['e']);
			foreach ($nums as $key => $value) {
					if(preg_match("/^\d$/i",$value)){
						$value='00'.$value;
					}elseif(preg_match("/^\d\d$/i",$value)){
						$value='0'.$value;
					}
					$txt = $value." ";
					echo "$txt";
				}
			for ($i=0; $i < 10 ; $i++) { 
				 shuffle($nums);
			}
			echo '<p>乱序存放</p>';
			$myfile = fopen("all.txt", "w") or die("Unable to open file!");
			foreach ($nums as $key => $value) {
					if(preg_match("/^\d$/i",$value)){
						$value='00'.$value;
					}elseif(preg_match("/^\d\d$/i",$value)){
						$value='0'.$value;
					}
					$txt = $value." ";
					echo "$txt";
					fwrite($myfile, $txt);
				}
			fclose($myfile);
		}
		for ($i=0; $i < 6; $i++) { 
			$file_name=$i.".txt";
			$f = fopen($file_name, "w") or die("Unable to open file!");
			fclose($f);
		}
		
		

	
?>